<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NeuZephyr: D:/Users/Mgepahmge/Documents/C Program/NeuZephyr/include/NeuZephyr/Tensor.cuh Source File</title>
<link rel="icon" href="NZ_logo2.png" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="NZ_logo2.png"/></td>
  <td id="projectalign">
   <div id="projectname">NeuZephyr
   </div>
   <div id="projectbrief">Simple DL Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_a7e6ee1ae3f772c9504a0b543f2027e2.html">Mgepahmge</a></li><li class="navelem"><a class="el" href="dir_e03f57e346cc4845a4c354a35630b169.html">Documents</a></li><li class="navelem"><a class="el" href="dir_231a0482af2b83c895f27ba7fe745141.html">C Program</a></li><li class="navelem"><a class="el" href="dir_0fa7fc3a0dfd304dbfc9dce9f6facfa2.html">NeuZephyr</a></li><li class="navelem"><a class="el" href="dir_e7295b03dab2e9cdf32139bd8ec2e607.html">include</a></li><li class="navelem"><a class="el" href="dir_657344ecc65cfc28732701509f8d8421.html">NeuZephyr</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">Tensor.cuh</div></div>
</div><!--header-->
<div class="contents">
<a href="_tensor_8cuh.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span><span class="preprocessor">#ifndef TENSOR_CUH</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span><span class="preprocessor">#define TENSOR_CUH</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span><span class="preprocessor">#include &lt;iterator&gt;</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span><span class="preprocessor">#include &lt;stdexcept&gt;</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="preprocessor">#include &quot;dl_export.cuh&quot;</span></div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="preprocessor">#include &quot;Dimension.cuh&quot;</span></div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacenz_1_1data.html">nz::data</a> {</div>
<div class="foldopen" id="foldopen00134" data-start="{" data-end="};">
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"><a class="line" href="classnz_1_1data_1_1_tensor.html">  134</a></span>    <span class="keyword">class </span>DL_API <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> {</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>        <span class="keyword">using </span>size_type = <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> long;</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>        <span class="keyword">using </span>value_type = float;</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>        <span class="keyword">using </span><a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a> = <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Dimension</a>;</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>        <span class="keyword">friend</span> DL_API std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, <span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; tensor);</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>        <span class="keyword">friend</span> DL_API std::istream&amp; operator&gt;&gt;(std::istream&amp; is, <span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; tensor);</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span> </div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>();</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span> </div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span>        <span class="keyword">explicit</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a>&amp; shape, <span class="keywordtype">bool</span> requires_grad = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span> </div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span>        <span class="keyword">explicit</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a>&amp; shape, value_type* data, <span class="keywordtype">bool</span> requires_grad = <span class="keyword">false</span>, <span class="keywordtype">bool</span> host = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span> </div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno">  243</span>        <span class="keyword">explicit</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a>&amp; shape, <span class="keyword">const</span> std::initializer_list&lt;value_type&gt;&amp; data,</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno">  244</span>                        <span class="keywordtype">bool</span> requires_grad = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno">  245</span> </div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno">  253</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other);</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno">  254</span> </div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno">  262</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>(<a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp;&amp; other) <span class="keyword">noexcept</span>(<span class="keyword">false</span>);</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span> </div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno">  273</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; operator=(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other);</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno">  274</span> </div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; operator=(<a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp;&amp; other) <span class="keyword">noexcept</span>(<span class="keyword">false</span>);</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span> </div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno">  292</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">~Tensor</a>() <span class="keyword">noexcept</span>(<span class="keyword">false</span>);</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno">  293</span> </div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno">  295</span> </div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno">  298</span> </div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno">  308</span>        [[nodiscard]] <span class="keywordtype">bool</span> requiresGrad() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno">  309</span> </div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno">  319</span>        [[nodiscard]] <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a> shape() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno">  320</span> </div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno">  330</span>        [[nodiscard]] size_type size() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno">  331</span> </div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno">  342</span>        <span class="keywordtype">void</span> setRequiresGrad(<span class="keywordtype">bool</span> requires_grad);</div>
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno">  343</span> </div>
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno">  365</span>        [[nodiscard]] value_type* data() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno">  366</span> </div>
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno">  404</span>        [[nodiscard]] std::vector&lt;value_type&gt; hostData() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno">  405</span> </div>
<div class="line"><a id="l00433" name="l00433"></a><span class="lineno">  433</span>        [[nodiscard]] value_type* grad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00434" name="l00434"></a><span class="lineno">  434</span> </div>
<div class="line"><a id="l00480" name="l00480"></a><span class="lineno">  480</span>        [[nodiscard]] std::vector&lt;value_type&gt; hostGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00481" name="l00481"></a><span class="lineno">  481</span> </div>
<div class="line"><a id="l00523" name="l00523"></a><span class="lineno">  523</span>        <span class="keywordtype">void</span> dataInject(value_type* data, <span class="keywordtype">bool</span> grad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00524" name="l00524"></a><span class="lineno">  524</span> </div>
<div class="line"><a id="l00566" name="l00566"></a><span class="lineno">  566</span>        <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Iterator&gt;</div>
<div class="foldopen" id="foldopen00567" data-start="{" data-end="}">
<div class="line"><a id="l00567" name="l00567"></a><span class="lineno"><a class="line" href="classnz_1_1data_1_1_tensor.html#ae3cc31f5b541809d75556ebbfda8ae57">  567</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="classnz_1_1data_1_1_tensor.html#ae3cc31f5b541809d75556ebbfda8ae57">dataInject</a>(Iterator begin, Iterator end, <span class="keyword">const</span> <span class="keywordtype">bool</span> grad = <span class="keyword">false</span>)<span class="keyword"> const </span>{</div>
<div class="line"><a id="l00568" name="l00568"></a><span class="lineno">  568</span>            <span class="keywordflow">if</span> (std::distance(begin, end) &lt; _size) {</div>
<div class="line"><a id="l00569" name="l00569"></a><span class="lineno">  569</span>                <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;The length of the input array is less than the size of the tensor.&quot;</span>);</div>
<div class="line"><a id="l00570" name="l00570"></a><span class="lineno">  570</span>            }</div>
<div class="line"><a id="l00571" name="l00571"></a><span class="lineno">  571</span>            <span class="keyword">auto</span>* host_data = <span class="keyword">new</span> value_type[_size];</div>
<div class="line"><a id="l00572" name="l00572"></a><span class="lineno">  572</span>            <span class="keyword">auto</span> it = begin;</div>
<div class="line"><a id="l00573" name="l00573"></a><span class="lineno">  573</span>            <span class="keywordflow">for</span> (<span class="keyword">auto</span> i = 0; i &lt; _size; ++i, ++it) {</div>
<div class="line"><a id="l00574" name="l00574"></a><span class="lineno">  574</span>                host_data[i] = <span class="keyword">static_cast&lt;</span>value_type<span class="keyword">&gt;</span>(*it);</div>
<div class="line"><a id="l00575" name="l00575"></a><span class="lineno">  575</span>            }</div>
<div class="line"><a id="l00576" name="l00576"></a><span class="lineno">  576</span>            <span class="keywordflow">try</span> {</div>
<div class="line"><a id="l00577" name="l00577"></a><span class="lineno">  577</span>                dataInject(host_data, grad);</div>
<div class="line"><a id="l00578" name="l00578"></a><span class="lineno">  578</span>            }</div>
<div class="line"><a id="l00579" name="l00579"></a><span class="lineno">  579</span>            <span class="keywordflow">catch</span> ([[maybe_unused]] <span class="keyword">const</span> std::runtime_error&amp; e) {</div>
<div class="line"><a id="l00580" name="l00580"></a><span class="lineno">  580</span>                <span class="keyword">delete</span>[] host_data;</div>
<div class="line"><a id="l00581" name="l00581"></a><span class="lineno">  581</span>                <span class="keywordflow">throw</span>;</div>
<div class="line"><a id="l00582" name="l00582"></a><span class="lineno">  582</span>            }</div>
<div class="line"><a id="l00583" name="l00583"></a><span class="lineno">  583</span>            <span class="keyword">delete</span>[] host_data;</div>
<div class="line"><a id="l00584" name="l00584"></a><span class="lineno">  584</span>        }</div>
</div>
<div class="line"><a id="l00585" name="l00585"></a><span class="lineno">  585</span> </div>
<div class="line"><a id="l00617" name="l00617"></a><span class="lineno">  617</span>        <span class="keywordtype">void</span> dataInject(<span class="keyword">const</span> std::initializer_list&lt;value_type&gt;&amp; data, <span class="keywordtype">bool</span> grad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00618" name="l00618"></a><span class="lineno">  618</span> </div>
<div class="line"><a id="l00620" name="l00620"></a><span class="lineno">  620</span> </div>
<div class="line"><a id="l00623" name="l00623"></a><span class="lineno">  623</span> </div>
<div class="line"><a id="l00642" name="l00642"></a><span class="lineno">  642</span>        <span class="keywordtype">void</span> zeroGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00643" name="l00643"></a><span class="lineno">  643</span> </div>
<div class="line"><a id="l00669" name="l00669"></a><span class="lineno">  669</span>        <span class="keywordtype">void</span> randomize(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> seed = 0) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00670" name="l00670"></a><span class="lineno">  670</span> </div>
<div class="line"><a id="l00690" name="l00690"></a><span class="lineno">  690</span>        <span class="keywordtype">void</span> clear() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00691" name="l00691"></a><span class="lineno">  691</span> </div>
<div class="line"><a id="l00715" name="l00715"></a><span class="lineno">  715</span>        <span class="keywordtype">void</span> fill(value_type value, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00716" name="l00716"></a><span class="lineno">  716</span> </div>
<div class="line"><a id="l00767" name="l00767"></a><span class="lineno">  767</span>        <span class="keywordtype">void</span> fillMatrix(value_type value, size_type batch, size_type channels, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00768" name="l00768"></a><span class="lineno">  768</span> </div>
<div class="line"><a id="l00769" name="l00769"></a><span class="lineno">  769</span> </div>
<div class="line"><a id="l00798" name="l00798"></a><span class="lineno">  798</span>        <span class="keywordtype">void</span> reshape(<span class="keyword">const</span> shape_type&amp; shape);</div>
<div class="line"><a id="l00799" name="l00799"></a><span class="lineno">  799</span> </div>
<div class="line"><a id="l00823" name="l00823"></a><span class="lineno">  823</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="namespacenz_1_1data.html#ac8d64dd271e9a2e50682e733bd14ec19">transpose</a>();</div>
<div class="line"><a id="l00824" name="l00824"></a><span class="lineno">  824</span> </div>
<div class="line"><a id="l00878" name="l00878"></a><span class="lineno">  878</span>        <span class="keywordtype">void</span> setData(<span class="keyword">const</span> shape_type&amp; position, value_type value, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00879" name="l00879"></a><span class="lineno">  879</span> </div>
<div class="line"><a id="l00881" name="l00881"></a><span class="lineno">  881</span> </div>
<div class="line"><a id="l00884" name="l00884"></a><span class="lineno">  884</span> </div>
<div class="line"><a id="l00915" name="l00915"></a><span class="lineno">  915</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#ab99b7c0a7c96a6de43f5b3f25af7f918">operator+</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00916" name="l00916"></a><span class="lineno">  916</span> </div>
<div class="line"><a id="l00947" name="l00947"></a><span class="lineno">  947</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">operator-</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00948" name="l00948"></a><span class="lineno">  948</span> </div>
<div class="line"><a id="l00981" name="l00981"></a><span class="lineno">  981</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#a8730252e35a8e59aacb429efb0d6b828">operator*</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00982" name="l00982"></a><span class="lineno">  982</span> </div>
<div class="line"><a id="l01018" name="l01018"></a><span class="lineno"> 1018</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#a771a257e9dd839ce330e9b40fd1dda56">operator/</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01019" name="l01019"></a><span class="lineno"> 1019</span> </div>
<div class="line"><a id="l01044" name="l01044"></a><span class="lineno"> 1044</span>        <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">operator-</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01045" name="l01045"></a><span class="lineno"> 1045</span> </div>
<div class="line"><a id="l01083" name="l01083"></a><span class="lineno"> 1083</span>        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01084" name="l01084"></a><span class="lineno"> 1084</span> </div>
<div class="line"><a id="l01114" name="l01114"></a><span class="lineno"> 1114</span>        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01115" name="l01115"></a><span class="lineno"> 1115</span> </div>
<div class="line"><a id="l01138" name="l01138"></a><span class="lineno"> 1138</span>        <span class="keywordtype">void</span> recip() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01139" name="l01139"></a><span class="lineno"> 1139</span> </div>
<div class="line"><a id="l01172" name="l01172"></a><span class="lineno"> 1172</span>        [[nodiscard]] value_type sum() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01173" name="l01173"></a><span class="lineno"> 1173</span> </div>
<div class="line"><a id="l01212" name="l01212"></a><span class="lineno"> 1212</span>        [[nodiscard]] value_type sum(size_type batch, size_type channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01213" name="l01213"></a><span class="lineno"> 1213</span> </div>
<div class="line"><a id="l01239" name="l01239"></a><span class="lineno"> 1239</span>        [[nodiscard]] value_type max() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01240" name="l01240"></a><span class="lineno"> 1240</span> </div>
<div class="line"><a id="l01273" name="l01273"></a><span class="lineno"> 1273</span>        [[nodiscard]] value_type max(size_type batch, size_type channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01274" name="l01274"></a><span class="lineno"> 1274</span> </div>
<div class="line"><a id="l01300" name="l01300"></a><span class="lineno"> 1300</span>        [[nodiscard]] value_type min() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01301" name="l01301"></a><span class="lineno"> 1301</span> </div>
<div class="line"><a id="l01333" name="l01333"></a><span class="lineno"> 1333</span>        [[nodiscard]] value_type min(size_type batch, size_type channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01334" name="l01334"></a><span class="lineno"> 1334</span> </div>
<div class="line"><a id="l01363" name="l01363"></a><span class="lineno"> 1363</span>        [[nodiscard]] shape_type find(value_type value) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01364" name="l01364"></a><span class="lineno"> 1364</span> </div>
<div class="line"><a id="l01401" name="l01401"></a><span class="lineno"> 1401</span>        [[nodiscard]] shape_type find(value_type value, size_type batch, size_type channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01402" name="l01402"></a><span class="lineno"> 1402</span> </div>
<div class="line"><a id="l01435" name="l01435"></a><span class="lineno"> 1435</span>        [[nodiscard]] value_type expSum() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01436" name="l01436"></a><span class="lineno"> 1436</span> </div>
<div class="line"><a id="l01479" name="l01479"></a><span class="lineno"> 1479</span>        [[nodiscard]] value_type expSum(<span class="keywordtype">size_t</span> batch, <span class="keywordtype">size_t</span> channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01480" name="l01480"></a><span class="lineno"> 1480</span> </div>
<div class="line"><a id="l01504" name="l01504"></a><span class="lineno"> 1504</span>        <span class="keywordtype">void</span> syncData() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01505" name="l01505"></a><span class="lineno"> 1505</span> </div>
<div class="line"><a id="l01529" name="l01529"></a><span class="lineno"> 1529</span>        <span class="keywordtype">void</span> syncGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01530" name="l01530"></a><span class="lineno"> 1530</span> </div>
<div class="line"><a id="l01554" name="l01554"></a><span class="lineno"> 1554</span>        <span class="keywordtype">void</span> sync() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01555" name="l01555"></a><span class="lineno"> 1555</span> </div>
<div class="line"><a id="l01557" name="l01557"></a><span class="lineno"> 1557</span> </div>
<div class="line"><a id="l01560" name="l01560"></a><span class="lineno"> 1560</span> </div>
<div class="line"><a id="l01591" name="l01591"></a><span class="lineno"> 1591</span>        std::ostream&amp; printGrad(std::ostream&amp; os) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01592" name="l01592"></a><span class="lineno"> 1592</span> </div>
<div class="line"><a id="l01619" name="l01619"></a><span class="lineno"> 1619</span>        std::ostream&amp; print(std::ostream&amp; os) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01620" name="l01620"></a><span class="lineno"> 1620</span> </div>
<div class="line"><a id="l01622" name="l01622"></a><span class="lineno"> 1622</span> </div>
<div class="line"><a id="l01623" name="l01623"></a><span class="lineno"> 1623</span> </div>
<div class="line"><a id="l01624" name="l01624"></a><span class="lineno"> 1624</span>    <span class="keyword">private</span>:</div>
<div class="line"><a id="l01625" name="l01625"></a><span class="lineno"> 1625</span>        size_type _size;</div>
<div class="line"><a id="l01626" name="l01626"></a><span class="lineno"> 1626</span>        shape_type _shape;</div>
<div class="line"><a id="l01627" name="l01627"></a><span class="lineno"> 1627</span>        value_type* _data;</div>
<div class="line"><a id="l01628" name="l01628"></a><span class="lineno"> 1628</span>        value_type* _grad;</div>
<div class="line"><a id="l01629" name="l01629"></a><span class="lineno"> 1629</span>        <span class="keywordtype">bool</span> _requires_grad;</div>
<div class="line"><a id="l01630" name="l01630"></a><span class="lineno"> 1630</span>    };</div>
</div>
<div class="line"><a id="l01631" name="l01631"></a><span class="lineno"> 1631</span>}</div>
<div class="line"><a id="l01632" name="l01632"></a><span class="lineno"> 1632</span> </div>
<div class="line"><a id="l01633" name="l01633"></a><span class="lineno"> 1633</span><span class="preprocessor">#endif </span><span class="comment">//TENSOR_CUH</span></div>
<div class="ttc" id="aclassnz_1_1data_1_1_dimension_html"><div class="ttname"><a href="classnz_1_1data_1_1_dimension.html">nz::data::Dimension</a></div><div class="ttdoc">Represents a multi - dimensional shape, typically used in deep learning for tensor dimensions.</div><div class="ttdef"><b>Definition</b> <a href="_dimension_8cuh_source.html#l00057">Dimension.cuh:57</a></div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_tensor_html"><div class="ttname"><a href="classnz_1_1data_1_1_tensor.html">nz::data::Tensor</a></div><div class="ttdoc">A class for representing and manipulating multidimensional arrays (tensors) in GPU memory.</div><div class="ttdef"><b>Definition</b> <a href="#l00134">Tensor.cuh:134</a></div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_tensor_html_ae3cc31f5b541809d75556ebbfda8ae57"><div class="ttname"><a href="classnz_1_1data_1_1_tensor.html#ae3cc31f5b541809d75556ebbfda8ae57">nz::data::Tensor::dataInject</a></div><div class="ttdeci">void dataInject(Iterator begin, Iterator end, const bool grad=false) const</div><div class="ttdoc">Injects data or gradient data into the tensor using iterators.</div><div class="ttdef"><b>Definition</b> <a href="#l00567">Tensor.cuh:567</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html"><div class="ttname"><a href="namespacenz_1_1data.html">nz::data</a></div><div class="ttdoc">Contains data structures and utilities for tensor operations in machine learning workflows.</div><div class="ttdef"><b>Definition</b> <a href="_dimension_8cuh_source.html#l00009">Dimension.cuh:9</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_a771a257e9dd839ce330e9b40fd1dda56"><div class="ttname"><a href="namespacenz_1_1data.html#a771a257e9dd839ce330e9b40fd1dda56">nz::data::operator/</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator/(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the division operator to divide a tensor of type T by a scalar float.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00689">TensorOperations.cuh:689</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_a8730252e35a8e59aacb429efb0d6b828"><div class="ttname"><a href="namespacenz_1_1data.html#a8730252e35a8e59aacb429efb0d6b828">nz::data::operator*</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator*(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the multiplication operator to multiply a tensor of type T by a scalar float.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00604">TensorOperations.cuh:604</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_ab99b7c0a7c96a6de43f5b3f25af7f918"><div class="ttname"><a href="namespacenz_1_1data.html#ab99b7c0a7c96a6de43f5b3f25af7f918">nz::data::operator+</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator+(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the addition operator to add a scalar float to a tensor of type T.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00436">TensorOperations.cuh:436</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_ac8d64dd271e9a2e50682e733bd14ec19"><div class="ttname"><a href="namespacenz_1_1data.html#ac8d64dd271e9a2e50682e733bd14ec19">nz::data::transpose</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; transpose(const T &amp;in)</div><div class="ttdoc">Transposes a tensor with a valid tensor type.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l01073">TensorOperations.cuh:1073</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_acc650ae262aba5f1b0fa9cca8cae311e"><div class="ttname"><a href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">nz::data::operator-</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator-(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the subtraction operator to subtract a scalar float from a tensor of type T.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00520">TensorOperations.cuh:520</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
